package com.qiche.service.impl;

import com.qiche.mapper.WxConfigMapper;
import com.qiche.model.WxConfig;
import com.qiche.service.WxConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * @author chendezhi
 * @date 2018/3/13 11:39
 */
@Service
public class WxConfigServiceImpl extends BaseService<WxConfig> implements WxConfigService {

    @Autowired
    private WxConfigMapper wxConfigMapper;
    @Override
    public WxConfig selectByMerchantId(String merchantId) {
        Example example = new Example(WxConfig.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("merchantId",merchantId);
        List<WxConfig> wxConfigs = wxConfigMapper.selectByExample(example);
        if (wxConfigs.size()==1){
            return wxConfigs.get(0);
        }
        return null;
    }
}
